#include "MCZoomController.h"
#include <iostream>

MCZoomController::MCZoomController(ICanvas *presenter) :
    _presenter(presenter)
{
}

void MCZoomController::wheelDown(IWheelArgs &args)
{
    MCPoint2D beforeZoom = args.globalPosition();

    if (args.delta() < 0)
    {
        _presenter->setDrawingScale(1.1);
    }
    else
    {
        _presenter->setDrawingScale(0.9);
    }

    MCPoint2D afterZoom = args.globalPosition();
    MCPoint2D deltaPos = beforeZoom - afterZoom;
    _presenter->setDrawingOffset(MCVector2(-deltaPos.x, deltaPos.y));
}
